home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 May / may_2001.iso / intercd / root / Multimedia / ^DivX_Article / DivX / VFW4048src / src / config_dialog.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-18  |  2.2 KB  |  90 lines

  1. // config_dialog.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "divx4windows.h"
  6. #include "config_dialog.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // ConfigDialog dialog
  16.  
  17.  
  18. ConfigDialog::ConfigDialog(CWnd* pParent /*=NULL*/)
  19.     : CDialog(ConfigDialog::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(ConfigDialog)
  22.     m_bitrate = 0;
  23.     m_rc_period = 0;
  24.     m_max_quant = 0;
  25.     m_min_quant = 0;
  26.     m_search_range = _T("");
  27.     //}}AFX_DATA_INIT
  28. }
  29.  
  30.  
  31. void ConfigDialog::DoDataExchange(CDataExchange* pDX)
  32. {
  33.     CDialog::DoDataExchange(pDX);
  34.     //{{AFX_DATA_MAP(ConfigDialog)
  35.     DDX_Control(pDX, IDC_SLIDER_BITRATE, m_slider_bitrate);
  36.     DDX_Text(pDX, IDC_BITRATE, m_bitrate);
  37.     DDV_MinMaxLong(pDX, m_bitrate, 0, 6000);
  38.     DDX_Text(pDX, IDC_RC_PERIOD, m_rc_period);
  39.     DDX_Text(pDX, IDC_MAX_QUANT, m_max_quant);
  40.     DDV_MinMaxInt(pDX, m_max_quant, 2, 31);
  41.     DDX_Text(pDX, IDC_MIN_QUANT, m_min_quant);
  42.     DDV_MinMaxInt(pDX, m_min_quant, 2, 31);
  43.     DDX_CBString(pDX, IDC_SEARCH_RANGE, m_search_range);
  44.     //}}AFX_DATA_MAP
  45. }
  46.  
  47.  
  48. BEGIN_MESSAGE_MAP(ConfigDialog, CDialog)
  49.     //{{AFX_MSG_MAP(ConfigDialog)
  50.     ON_EN_CHANGE(IDC_BITRATE, OnChangeBitrate)
  51.     ON_WM_HSCROLL()
  52.     //}}AFX_MSG_MAP
  53. END_MESSAGE_MAP()
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // ConfigDialog message handlers
  57.  
  58. BOOL ConfigDialog::OnInitDialog() 
  59. {
  60.     CDialog::OnInitDialog();
  61.  
  62.     m_slider_bitrate.SetRange(0, 6000, FALSE);
  63.     m_slider_bitrate.SetPos(m_bitrate);
  64.  
  65.     UpdateData(FALSE);
  66.     
  67.     return TRUE;  // return TRUE unless you set the focus to a control
  68.                   // EXCEPTION: OCX Property Pages should return FALSE
  69. }
  70.  
  71. void ConfigDialog::OnChangeBitrate() 
  72. {
  73.     // When the edit box for bitrate is changed, update the slider.
  74.     UpdateData(TRUE);
  75.     m_slider_bitrate.SetPos(m_bitrate);
  76.     UpdateData(FALSE);
  77. }
  78.  
  79. void ConfigDialog::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
  80. {
  81.     // When the slider is changed, update the edit box.
  82.     if ((CSliderCtrl*)pScrollBar == &m_slider_bitrate) {
  83.         m_bitrate = m_slider_bitrate.GetPos();
  84.         UpdateData(FALSE);
  85.         return;
  86.     }
  87.     
  88.     CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
  89. }
  90.